home *** CD-ROM | disk | FTP | other *** search
/ Cre@te Online 2000 December / Cre@teOnline CD05.iso / MacSoft / XML ConsoleMax.sea / XML ConsoleMax / Required / parser.jar / com / sun / xml / tree / NodeBase.class (.txt) < prev    next >
Encoding:
Java Class File  |  2000-02-23  |  4.3 KB  |  210 lines

  1. package com.sun.xml.tree;
  2.  
  3. import java.io.IOException;
  4. import java.util.Locale;
  5. import org.w3c.dom.Attr;
  6. import org.w3c.dom.DOMException;
  7. import org.w3c.dom.Document;
  8. import org.w3c.dom.NamedNodeMap;
  9. import org.w3c.dom.Node;
  10. import org.w3c.dom.NodeList;
  11.  
  12. abstract class NodeBase implements Node, NodeEx, NodeList, XmlWritable {
  13.    private ParentNode parent;
  14.    private int parentIndex = -1;
  15.    XmlDocument ownerDocument;
  16.    boolean readonly;
  17.  
  18.    public Node appendChild(Node var1) throws DOMException {
  19.       throw new DomEx((short)3);
  20.    }
  21.  
  22.    public abstract Node cloneNode(boolean var1);
  23.  
  24.    public NamedNodeMap getAttributes() {
  25.       return null;
  26.    }
  27.  
  28.    public NodeList getChildNodes() {
  29.       return this;
  30.    }
  31.  
  32.    public Node getFirstChild() {
  33.       return null;
  34.    }
  35.  
  36.    public int getIndexOf(Node var1) {
  37.       return -1;
  38.    }
  39.  
  40.    public String getInheritedAttribute(String var1) {
  41.       Object var2 = this;
  42.       Attr var3 = null;
  43.  
  44.       do {
  45.          if (var2 instanceof ElementNode) {
  46.             ElementNode var4 = (ElementNode)var2;
  47.             if ((var3 = var4.getAttributeNode(var1)) != null) {
  48.                break;
  49.             }
  50.          }
  51.  
  52.          var2 = ((NodeBase)var2).getParentImpl();
  53.       } while(var2 != null);
  54.  
  55.       return var3 != null ? var3.getValue() : null;
  56.    }
  57.  
  58.    public String getInheritedAttribute(String var1, String var2) {
  59.       Object var3 = this;
  60.       Attr var4 = null;
  61.  
  62.       do {
  63.          if (var3 instanceof ElementNode) {
  64.             ElementNode var5 = (ElementNode)var3;
  65.             if ((var4 = var5.getAttributeNode(var1, var2)) != null) {
  66.                break;
  67.             }
  68.          }
  69.  
  70.          var3 = ((NodeBase)var3).getParentImpl();
  71.       } while(var3 != null);
  72.  
  73.       return var4 != null ? var4.getValue() : null;
  74.    }
  75.  
  76.    public String getLanguage() {
  77.       return this.getInheritedAttribute("xml:lang");
  78.    }
  79.  
  80.    public Node getLastChild() {
  81.       return null;
  82.    }
  83.  
  84.    public int getLength() {
  85.       return 0;
  86.    }
  87.  
  88.    String getMessage(String var1) {
  89.       return this.getMessage(var1, (Object[])null);
  90.    }
  91.  
  92.    String getMessage(String var1, Object[] var2) {
  93.       Locale var3;
  94.       if (this instanceof XmlDocument) {
  95.          var3 = ((XmlDocument)this).getLocale();
  96.       } else if (this.ownerDocument == null) {
  97.          var3 = Locale.getDefault();
  98.       } else {
  99.          var3 = this.ownerDocument.getLocale();
  100.       }
  101.  
  102.       return XmlDocument.catalog.getMessage(var3, var1, var2);
  103.    }
  104.  
  105.    public Node getNextSibling() {
  106.       if (this.parent == null) {
  107.          return null;
  108.       } else {
  109.          if (this.parentIndex < 0 || this.parent.item(this.parentIndex) != this) {
  110.             this.parentIndex = this.parent.getIndexOf(this);
  111.          }
  112.  
  113.          return this.parent.item(this.parentIndex + 1);
  114.       }
  115.    }
  116.  
  117.    public abstract String getNodeName();
  118.  
  119.    public abstract short getNodeType();
  120.  
  121.    public String getNodeValue() {
  122.       return null;
  123.    }
  124.  
  125.    public Document getOwnerDocument() {
  126.       return this.ownerDocument;
  127.    }
  128.  
  129.    ParentNode getParentImpl() {
  130.       return this.parent;
  131.    }
  132.  
  133.    public Node getParentNode() {
  134.       return this.parent;
  135.    }
  136.  
  137.    public Node getPreviousSibling() {
  138.       if (this.parent == null) {
  139.          return null;
  140.       } else {
  141.          if (this.parentIndex < 0 || this.parent.item(this.parentIndex) != this) {
  142.             this.parentIndex = this.parent.getIndexOf(this);
  143.          }
  144.  
  145.          return this.parent.item(this.parentIndex - 1);
  146.       }
  147.    }
  148.  
  149.    public boolean hasChildNodes() {
  150.       return false;
  151.    }
  152.  
  153.    public Node insertBefore(Node var1, Node var2) throws DOMException {
  154.       throw new DomEx((short)3);
  155.    }
  156.  
  157.    public boolean isReadonly() {
  158.       return this.readonly;
  159.    }
  160.  
  161.    public Node item(int var1) {
  162.       return null;
  163.    }
  164.  
  165.    public Node removeChild(Node var1) throws DOMException {
  166.       throw new DomEx((short)3);
  167.    }
  168.  
  169.    public Node replaceChild(Node var1, Node var2) throws DOMException {
  170.       throw new DomEx((short)3);
  171.    }
  172.  
  173.    public void setNodeValue(String var1) {
  174.       if (this.readonly) {
  175.          throw new DomEx((short)7);
  176.       }
  177.    }
  178.  
  179.    void setOwnerDocument(XmlDocument var1) {
  180.       this.ownerDocument = var1;
  181.    }
  182.  
  183.    void setParentNode(ParentNode var1, int var2) throws DOMException {
  184.       if (this.parent != null && var1 != null) {
  185.          this.parent.removeChild(this);
  186.       }
  187.  
  188.       this.parent = var1;
  189.       this.parentIndex = var2;
  190.    }
  191.  
  192.    public void setReadonly(boolean var1) {
  193.       this.readonly = true;
  194.       if (var1) {
  195.          TreeWalker var2 = new TreeWalker(this);
  196.  
  197.          Node var3;
  198.          while((var3 = var2.getNext()) != null) {
  199.             ((NodeBase)var3).setReadonly(false);
  200.          }
  201.       }
  202.  
  203.    }
  204.  
  205.    public void writeChildrenXml(XmlWriteContext var1) throws IOException {
  206.    }
  207.  
  208.    public abstract void writeXml(XmlWriteContext var1) throws IOException;
  209. }
  210.